<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="../common/include/header.jsp" %>

<%@ page import="java.util.*,util.*,board.*" %>

<div>
<table border="0" cellpadding="0" cellspacing="0" width="980px">
	<tr>
		<td style="vertical-align: top;width: 180px;background-color:  #fdb73a;">
			
<!-- Left Menu Including -->
<%@ include file="../common/include/leftmenu.jsp" %>

		</td>
		
		<td style="text-align: center;width: 800px;background: #ffffff; vertical-align: top;">

<!-- 여기서부터 게시판 내용 -->
<div id="freeMain" style="text-align: center;background-color: #ffffff;">
<html:form action="/freeboard.do">

<%@include file="logo.jsp" %>

<div class="boardname">	<bean:write name="freeForm" property="fbname"/></div>
		
<table style="width: 700px; text-align: center;" id="flist" border="0" cellpadding="0" cellspacing="0">
	<tr style="height: 20px;">
		<td style="width: 50px;background-image: url('<%=imagePath %>boardlist_topbg_01.jpg');" class="fbtd2"></td>
		<td style="width: 100px;background-image: url('<%=imagePath %>boardlist_topbg_02.jpg');" class="fbtd2"></td>
		<td style="background-image: url('<%=imagePath %>boardlist_topbg_03.jpg');" class="fbtd2"></td>
		<td style="width: 100px;background-image: url('<%=imagePath %>boardlist_topbg_04.jpg');" class="fbtd2"></td>
		<td style="width: 50px;background-image: url('<%=imagePath %>boardlist_topbg_05.jpg');" class="fbtd2"></td></tr>
	
<!-- 게시물 표시 -->
<% Date date = new Date(); %>
<logic:iterate id="list" name="freeForm" property="freelists">
	<tr id="<bean:write name="list" property="fbno"/>" onmouseover="changeBGC(<bean:write name="list" property="fbno"/>)" onmouseout="returnBGC(<bean:write name="list" property="fbno"/>)">
	
		<td class="fbtd"><bean:write name="list" property="rownum"/></td>
		
		<td class="fbtd"><a href="javascript:;" onmousedown="popmenu1('<bean:write name="list" property="mid"/>');" >
		<bean:write name="list" property="mcnick"/></a></td>
		
		<td class="fbtd" style="text-align: left;"><a href="freeboard.do?method=detailView&fbno=<bean:write name="list" property="fbno"/>">
		
		<bean:write name="list" property="fbtitle"/><logic:greaterThan value="0" name="list" property="fbcomments">
		<font style="font-size: 7pt;">[<bean:write name="list" property="fbcomments"/>]
		</logic:greaterThan></font></a></td>

		<td class="fbtd"><bean:write name="list" property="fbsdate"/></td>
		
		<td class="fbtd"><bean:write name="list" property="fbcounter"/></td></tr>				
		
</logic:iterate>

<!-- 페이징 -->
		<tr><td colspan="5">

<%if (request.getParameter("search")!=null){ %>
<%  	if(request.getParameter("search").matches("snick")){ %>
			<jsp:include page="pager.jsp">
				<jsp:param name="url" value="freeboard.do?method=getList&search=snick"/>
			</jsp:include>
<% 	} else if(request.getParameter("search").matches("stitle")){ %>
			<jsp:include page="pager.jsp">
				<jsp:param name="url" value="freeboard.do?method=getList&search=stitle"/>
			</jsp:include>
<%	}
	} else { %>
			<jsp:include page="pager.jsp">
				<jsp:param name="url" value="freeboard.do?method=getList"/>
			</jsp:include>
<% } %>

		</td></tr>
		
<!-- 검색기능 -->		
	<tr><td colspan="5"><select name="search" class="searchForm">
		<option value="snick" selected="selected">작성자</option><option value="stitle">제목</option>
	</select><input type="text" size="20" name="word" class="searchForm"/><html:link href="javascript:search()" indexId="0">
	<img src="<%=imagePath %>icon_search.jpg" style="vertical-align: text-bottom;"/></html:link></td></tr>

<!-- 글쓰기(submit), 목록 -->
	<tr><td style="text-align: right;" colspan="5"><html:link href="javascript:freeForm.submit();"><img src="<%=imagePath %>icon_write.jpg"/></html:link>
		<a href="javascript:getBoard('freeboard.do?method=getList&currentPage=<bean:write name="pager" property="currentPage"/>
	&cono=<bean:write name="freeForm" property="cono"/>&fbname=','<bean:write name="freeForm" property="fbname"/>');"><img src="<%=imagePath %>icon_list.jpg"/></a>
		</td></tr>
		

</table><input type="hidden" name="fbname" value="<bean:write name="freeForm" property="fbname"/>"/>
<input type="hidden" name="cono" value="<bean:write name="freeForm" property="cono"/>"/>
<input type="hidden" name="method" value="insertform"/>

</html:form>
</div>

<script type="text/javascript">
<!--
	function search(){
		var word = document.getElementById('word').value.replace(/\s/g,"");
		var listForm = document.getElementById('freeForm');
		document.getElementById('method').value='getList';
		var search = document.getElementById('search').value;
		if(word.length>0){
			if(search=='snick'){
				listForm.submit();
			} 
			if(search=='stitle'){
				listForm.submit();
			}			
		} else {
			document.getElementById('search').value="";
			document.getElementById('word').value="";
			listForm.submit();
		}
	}

-->
</script>
		</td>		
	</tr>
</table>
</div>

<%@ include file="../common/include/footer.jsp" %>